app on AndroidThings preview 5.1 doesn't reboot - android-things

I have several app that I am working on for AndroidThing. With preview 5.1 and RPI3, I image the SDcard with the 5.1 image. I then install the apps from Android Studio (2.3.3).
1) One of the apps runs properly when downloaded. But when I try to reboot the RPI3, the app doesn't restart and I just have the AndroidThings splash screen on my display.
2) I do the same process to load the second app (on a different SDcard). This app runs for about one minute before it "crashes" and I end up again in the AndroidThings splash screen. When I restart the RPI3 all I get is the AndroidThings splash screen.
Is this an issue with the 5.1 preview? I have not tried it on 5.0. On 4.1 I was not having this problem. I had no crashes of the app and when I restarted the RPI3, the app started up.
I can't see any obvious error messages in the logs.
I'm going to see if I can try it on 5.0 but I had initial issues with 5.0 when it first came out and different run the apps on it.

You need to make sure that your apps have a Home Activity declared with the IOT_LAUNCHER and DEFAULT categories in an intent filter as described in our Getting Started tutorial. This tells Android Things which of your apps should be started automatically on boot.
You can only define one application on a given device to listen for this intent. Android Things will not start multiple apps this way. You may need to listen for the BOOT_COMPLETED broadcast in other apps on the device you need to launch automatically.

Related

Two Ionic apps on iPhone appearing to open each other

I have two completely different Ionic apps running on my iPhone and I can get one to open the other and visa versa!
First app, App-V3, is an Ionic V3 app that has been in production for years and has been downloaded for App Store. Second app, App-V4, is an Ionic V4 app that is still in development and loaded onto my phone with Xcode. The code bases are completely different as are the back-ends and remote databases.
Procedure: both apps have been stopped, i.e. will restart, display launch image, to open.
Either app - start, wait for launch image to come and go, and then the app becomes live.
Close this app using home button on my iPhone6S.
Then immediately open the other app.
The correct launch image displays but the original app appears!! The order makes no difference, start with App-V3 or App-V4, will have that app running in the other with above steps.
This does seem to be time dependent. After opening one app, after that app becomes live, if I wait for approximately 6 seconds or more, then close it, and immediately open the other app, then this app will start correctly. It seems that if I wait for only 5 seconds or less, then I will see the issue.
I would like to understand why this is happening. Thanks.
Maybe you have the same Id in the config.xml of your both projects, I know in android wont let you install it if its the same.

How to check if an app is running in iOS device from a mac terminal

I am trying to launch ios app from python script/terminal using ios-deploy. This is a test app so it might crash and need to relaunch multiple times.
I want to check if this app is currently running or not on the connected device, for my relaunch logic to work. But I am kind of stuck here.
I know idevicesyslog which can capture logs and then parsing logs I can check if my app is currently running or not. But isn't there any sophisticated way to just check if an app is currently running or not in device. Xcode/instruments can get the list of processes via GUI in connected device but I want a command line utility so that I can take certain action.
You can check app or debug app using safari.
Open safari.
And If develop option not available on top navigation bar then open preferences of safari and in advance tab tick show develop option in below that screen.

My WatchOS2 app stuck on launch with Spinner

I built a demo app on WatchOS 2.0.1, on every launch it was getting stuck with App name on Top Left corner and spinner in middle of screen on iWatch (38mm). Watch is brand new and have only native apps installed till now so there should not be any issue with memory.
I tried many times to open the app but it was repeatedly closing automatically after showing Spinner for sometime. After lots of trial my Apps screen got visible and then after on every launch it worked fine without sticking on launch. I tried to double check by Force quit my app using Power button but it worked fine then after.
Then I uninstalled the app from watch and reinstalled it and same thing happened again. It started sticking. Do anyone have Idea on this? Please help on this part.
WatchOS Version : 2.0.1
Your app is crashing, as evidenced by it "automatically closing."
You should be able to track down the reason for the crash by examining the crash report (which can be found in the Xcode Window -> Devices pane). Alternately, you should be able to interactively debug this by running the app within Xcode.
As for it eventually no longer crashing until you deleted and reinstalled the app, the app reached a state where the reason for the crash no longer occurred. This probably is related to needing to handle some error pertaining to a path or file which it is finally able to create or access. Deleting the app recreated the condition where it repeatedly crashed again.

Debug WatchKit on real Apple Watch - Nothing happens

I am struggling with debugging my WatchKit Extension/App on a real Apple Watch. Debugging both the iPhone App and the WatchKit Extension using the simulator the simulator is not problem:
Select the WatchKit App Profile and run in Simulator ==> App is launched on in Watch Simulator and I can use breakpoints in the Extension code to debug.
To debug the iPhone app as well I launch the app in the simulator and attach the debugger manually ==> I can use breakpoints in the iPhone Code to debug.
It is no problem to observe both the work of the iPhone app and the watch app. At least not in the simulator.
I would like to do the same thing on a real Apple Watch. But when I select the WatchKit App Profile and my real iPhone (instead of the Simulator) and click on "Run" nothing happens. This means Xcode seems to build and start the app but nothing happens on the devices. The status field in Xcode shows:
Building MyApp WatchKit App: MyApp WatchKit Extension
Building MyApp WatchKit App: Finishing...
Running MyApp on My iPhone 6
This is all. No debug Window, breakpoints are ignored or do not work and the app is not launched neither on the iPhone or on the Apple Watch.
I found other questions about problems with debugging on real devices (e.g. here) but they all deal with installation and signing issues. In my case both the iPhone App and the WatchKit App are installed without any problem. When I click the app icon on the Watch I can start and use the app. Problem is that I cannot debug this process.
Why do I need to debug the process on real devices? Well there is one thing I cannot test using the simulator: What happens when the Watch App tries to contact the iPhone app using openParentApplication:reply: when the iPhone app is not already running? This works perfectly in the simulator but on real devices the Watch Apps seems to get no reply from the iPhone app and simply waits forever.
I already found hints to solve this but without being able to debug the Watch App and to see how the code is executed I cannot be sure what is going on...
thank you for your answers. I finally managed to get the debugging running (most of the time) on my real Apple Watch. However it is quite cumbersome and not very reliable. There is not enough space in the comments so I will use this answer to describe my solution. Maybe it is help full to other:
Make sure, the App on your Watch is not running (as BalestraPatrick described). Launch the app and hold the side button a few seconds to bring up the "Turn off your Watch" dialog. Hold the side button for another few seconds to close the app and to return to the Watch homescreen.
Make sure the iPhone is not locked.
Select the WatchKit App target and your real iPhone and run the project.
Running the Watch App resulted quite often in an error SPErrorInvalidBundleNoGizmoBinaryMessage. Re-starting Xcode and cleaning both the Watch App and the App target solved this.
If the build of the Watch App succeed there will be a short message in Xcode but nothing on your iPhone or Watch. If you have made changes to the Watch App it will take a few seconds to refresh the app on the Watch. This is indicated by the progress-circle overlay over the app icon. If you made no changes ore once the app has been transfered: Launch the watch app manually by tapping the icon. There will be no automatic launch.
In most cases Xcode will recognize the app launch and attach its debugger to it. This will allow to use breakpoints, inspect the code, etc.
In my case I whanted to inspect how the iPhone App handles the application:handleWatchKitExtensionRequest:reply: call when the app was not active before. This is important because this cannot be done using the simulator. If the app takes to long to handle the request the Watch will receive no valid response.
After following the steps described above Xcode is only attached the watch app and will not hold on breakpoints in the iPhone app code. To do this, one has to manually attach the Debugger to the iPhone app process that is started when the watch app sends its call.
To be able to attach the debugger I added a delay to the apps main function: [NSThread sleepForTimeInterval:5]:
Select function in Watch App that will start the call to the iPhone App
The iPhone App will be launched in background. The delays gives you 5 seconds to attach the debugger.
Choose Debug\Attach To Process\Likely Targes\Your iPhone Appin Xcode to attach the debugger.
After the 5 seconds delay the process will continue and you will be able to use breakpoints in your iPhone app code as well.
Do not forget do remove the delay code when you finished testing :-)
NOTE:
You will not be able to see NSLog output (or any console output at all) from the iPhone App since attaching the debugger does NOT re-route the console output.
Happy testing with this awesome new Apple product :-P
I am having the same kind of issue but to improve a little bit the debugging experience I usually restart my devices a few times. Try to restart your Apple Watch or your iPhone.
Before launching your app from Xcode, make sure that the app is completely closed on your Apple Watch (not stuck in the loading screen for example). To do that, you have to force close the app: enter your app, keep the side button pressed until the menu to turn off the watch appears, then press the same side button for a few more seconds until the watch will go back to the homescreen and force close your app.
Now you can try to build and run the app from Xcode and it should work more reliably.
watchOS 3+:
The force quit is done by pressing and holding the side button (the button just below the Digital Crown) until the shutdown screen appears, and then
let go of the side button, then press and hold the Digital Crown.
Here's a technique that seems to be be the most reliable for me, even though it still only works about 25% of the time (Xcode 7 beta 4, 7A165t):
Run the phone target in debug (on your actual iPhone of course)
While the iPhone app is still running, switch to the watch target and run that in debug.
Keep an eye on your watch homescreen as the app installs. Once the app has installed, tap it to open it. This will sometimes "kickstart" the watch app and allow the debugger to catch it. At this point you should be able to debug both your iPhone app and watchOS app together.
This question has different answers. All are good.
The reason is: in my experience there are at least two different problems that prevent debugging on a real watch. Both require a different strategy.
This answer tries to help you to decide when to use which strategy.
XCode installs, tells you it is running for a short time and then stops showing "running...".
start with the answer of BalestraPatrick:
restart your devices.
Do not forget to restart your iPhone. This did the trick the first time I had this problem.
XCode installs, tells you it is running for a longer period of time: "running <projectName> on Apple Watch of <yourname>.
start with the answer of Jay Hickey or Andrei Herford
starting the watch app manually probably does the trick.
I also had times when XCode was able to start my watch app without any help from me.
Bonus:
Starting with XCode 7.1 it seems XCode doesn't always compile all necessary Swift files (more often than before). This is not watch specific, it also applies to iOS apps. The symptoms can look similar to those of this question. -> clean your project and then restart XCode.

ios app-on-device debugging events

Newbie here, so apologies if this is stupid question:
Are there any applications or solutions out there that would allow you access to debugging events on an app installed on your iphone? To be clear, this isn't an app I've developed, it's just on my iphone and is used as part of another solution which we are developing. Curious if there's a way to just watch the events on an app to help with debugging process.
Thanks.
If you make an app, and build it with a development release, and development signing, you can select to build+run it on a device. Then, you can use the Xcode debugger to see your logs / errors etc.
Steps:
Plug in iPhone
Start Xcode
Hit Build + run
Watch debugger
Logs are either made by the OS for certain things (NSinconsistency, bad constraints, race conditions in view presentation) or by you with NSLog.
Or did you mean when the app is not tethered to your computer? There are other tools for that - including just plugging the phone back in and downloading the logs off the device.

Resources