How to run Android Things app automatically on boot? - android-things

When there is a power failure on my Raspberry, Android Things restarts on the main page without my application and I have to resend it manually, how can I fix Android Things to run the application automatically on reboot?

According to the documentation, you should include two intent-filters for the app's launcher Activity, one for launching app deployed through Android Studio and another one for launching app on each boot:
<activity android:name=".HomeActivity">
<!-- Launch activity as default from Android Studio -->
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<!-- Launch activity automatically on boot, and re-launch if the app terminates. -->
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.HOME"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>

Related

intent_filter: run apk build in UNITY from url

I have a problem running the app via url.
I added to manifest intent-filter, but it does not work.
I would like to have the application launch after the url, of course it is on the device.
This is the code activity in my android manifest:
<activity android:label="#string/app_name" android:name="com.unity3d.player.UnityPlayerActivity" android:screenOrientation="fullSensor" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="testurl" android:host="app.open"/>
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
Is there anyone able to help me?
It works. It was necessary to create an html with a URL.

Ship google-services.json with ionic package builds

Since I do not have Mac and iPhone, the only option for me is to use Ionic Cloud to build my native binaries. However, first I wanted to play with it and see how will it work with android builds.
My application uses https://github.com/fechanique/cordova-plugin-fcm
So I can build application with ionic cordova build android and run it on my emulator without any problems. However if I execute ionic package build android and then ionic package info I get message that my build FAILED.
Examine this failure with ionic package BUILD_ID I get this message:
Error: cordova-plugin-fcm: You have installed platform android but file 'google-services.json' was not found in your Cordova project root folder.
So, looks like that my google-services.json does not get uploaded to the cloud. So searching I find few posts of people that had same problem but none of them provided me with solution. I also found this:
https://cordova.apache.org/docs/en/latest/config_ref/index.html#resource-file
So I have tried to tell to ionic to include this google-services.json file with package like this:
<?xml version='1.0' encoding='utf-8'?>
<widget id="me.citybeep.partnerapp" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<!-- ... -->
<platform name="android">
<!-- ... -->
<resource-file src="google-services.json" target="platforms/android/google-services.json" />
</platform>
<!-- ... -->
<engine name="android" spec="^6.2.3" />
<plugin name="cordova-plugin-device" spec="^1.1.4" />
<plugin name="cordova-plugin-fcm" spec="^2.1.2" />
<plugin name="cordova-plugin-splashscreen" spec="^4.0.3" />
<plugin name="cordova-plugin-statusbar" spec="^2.2.2" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.1" />
<plugin name="cordova-sqlite-storage" spec="^2.0.4" />
<plugin name="de.appplant.cordova.plugin.local-notification" spec="^0.8.5" />
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
</widget>
And also tried this:
<resource-file src="google-services.json" target="google-services.json" />
But we no success, however now I get another message:
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: me.citybeep.partnerapp
Name: City_Beep_Partner
Activity: MainActivity
Android target: android-25
Subproject Path: CordovaLib
Android project created with cordova-android#6.2.3
Error: Source path does not exist: google-services.json
I think this error is just that google-services.json did not get uploaded.
I am really dependent now on this plugin and using Ionic Push notifications is not an options at the moment...
So is there any way to tell ionic to include this google-services.json file when uploading to the cloud (and also .plist file). And I repeat, it is not problem with google-services.json file or my firebase project as everything works fine while performing build on my machine.
i tried several solutions, but the only one worked for me was specifying src and target with relative path of the google-services.json.
In your case change
<resource-file src="google-services.json" target="platforms/android/google-services.json" />
to
<resource-file src="platforms/android/google-services.json" target="platforms/android/google-services.json" />
this should work.

Ionic View with Ionic 2 app

I know the Ionic View does not support all Cordova plugins (http://docs.ionic.io/docs/view-usage).
I have an app that is working in Chrome and on Android device.
When trying the same app with Ionic View with my Android device, it seems the http requests are not returning anything.
I don't see whitlist support, so do you think it could be the cause of my issue?
If so, is there a way to make it work?
Any plan, by Ionic team, to add that cordova plugin support?
[UPDATE]
Here is my AndroidManifesst.xml
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="io.ionic.starter" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="#drawable/icon" android:label="#string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="#string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="#android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="#string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:clearTaskOnLaunch="true" android:configChanges="orientation|keyboardHidden" android:exported="false" android:name="com.google.zxing.client.android.CaptureActivity" android:theme="#android:style/Theme.NoTitleBar.Fullscreen" android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
<action android:name="com.google.zxing.client.android.SCAN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:label="#string/share_name" android:name="com.google.zxing.client.android.encode.EncodeActivity">
<intent-filter>
<action android:name="com.phonegap.plugins.barcodescanner.ENCODE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:label="#string/share_name" android:name="com.google.zxing.client.android.HelpActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
</manifest>

Xcode PhoneGap navigator.connection Undefined

Trying to port my PhoneGap javascript code into Xcode for debugging in iOS.
Using Cordova-3.0.0.
When I call:
navigator.connection.type
I am getting an 'undefined' for navigator.connection.
Did I not include the network connection plugin correctly in my config.xml, or is something else amiss? Yes, I included the correct cordova.js file specifically for iOS. Yes, deviceready has been fired.
Update: I am currently only running this on the iOS emulator.
My config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.app.test" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Hello Cordova</name>
<description>
Description
</description>
<author email="dev#callback.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<access origin="*" />
<preference name="fullscreen" value="true" />
<preference name="webviewbounce" value="true" />
<plugins>
<plugin name="NetworkStatus" value="CDVConnection" />
</plugins>
</widget>
Thank you for your help!
Been doing my research on this one, and finally came up with the solution.
Apparently PhoneGap (Adobe) recently updated their documentation, and filled in a lot of the holes I was running into for Phonegap 3.0.0
1) To do this using the command-line interface, you have to have git installed to be able to run those commands. Get git here.
2) They added to the Connection plugin documentation to use the following command-line interface commands to add the plugin to the project:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information.git
$ cordova plugin rm org.apache.cordova.core.network-information
3) They updated the declaration in the config.xml file to the following (for iOS):
<feature name="NetworkStatus">
<param name="ios-package" value="CDVConnection" />
</feature>
If you simply want to know if you are connected or not try using navigator.onLine in your js instead. Works for me on IOS 8 & Android 2.3 and doesn't require any plugins

Can't run the BlackBerry 10 jQuery Mobile theme kitchensink

I downloaded the BlackBerry 10 jQuery Mobile theme and I wanted to try how it works on the Dev Alpha.
I created this config.xml
<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets"
xmlns:rim="http://www.blackberry.com/ns/widgets"
version="1.0.0.0" rim:header="JQKS">
<author href="http://www.dandandin.net/"
rim:copyright="Copyright 2012 Dandandin.net">Dandandin.net</author>
<name>JQ Kitchensink</name>
<description>An app to test jquery</description>
<icon src="img/generic_81_81_placeholder.png" />
<content src="index.html"/>
<feature id="blackberry.invoke" version="1.0.0"/>
</widget>
and I placed it on /kitchensink
Then I packaged /kitchensink and loaded on my dev alpha, but I get this when I launch it:
I can press OK, but the application is frozen.
If I load it on my local webserver, and browse from the dev alpha it works, what's wrong?
In order to make it work, you have to update to the latest 1.0.3.8 SDK.
I had 1.0.2 and it didn't work.

Resources