I have an android wear app, in which I want to have a continue on device button which launches the companion app on the mobile device.
When the App is already launched I can "restart" it using this Remote Intent.
How can I start the companion app from a standstill?
Intent intentAndroid = new Intent(Intent.ACTION_VIEW)
.addCategory(Intent.CATEGORY_BROWSABLE)
.setData(Uri.parse("myApplication"));
RemoteIntent.startRemoteActivity(context, intentAndroid, null);
Thanks in advance.
I finally figured it out.
I missed adding an intent filter in the android manifest for the activity I wanted to start.
For example:
<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="myAppName" android:host="MainActivity" />
</intent-filter>
Then you can start it from the watch using:
Intent intentAndroid = new Intent(Intent.ACTION_VIEW)
.addCategory(Intent.CATEGORY_BROWSABLE)
.setData(Uri.parse("myAppName://MainActivity"));
RemoteIntent.startRemoteActivity(context, intentAndroid, null);
Related
I'm facing one issue, I'm using a webview of my web application, when a user clicks the registration link on Gmail then the home page opens on the app instead of the actual link, for example, this link will be used to register the user: https://domainname/index.php?r=user%2Fregistration&token= after clicking on the link, the pop will show, launch this link on app or browser, when I click on the browser, its working fine, but when I open on app webview then the home page will open instead of the actual link. How can I solve this issue?
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="domainlink" />
</intent-filter>
I'm using this intent filter on the manifest file
I've followed the Firebase Quickstart Messaging Tutorial, and I've a problem.
I'd like to launch the two services (MyFirebaseMessagingService and MyFirebaseInstanceIDService) on the boot of the system.
For that, I've added the RECEIVE_BOOT_COMPLETED permission to my AndroidManifest.xml.
I've also added this to the Manifest :
<receiver android:name=".AutoStart">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
</intent-filter>
</receiver>
In my AutoStart class, there is this :
#Override
public void onReceive(Context context, Intent intent) {
context.startService(new Intent(context, MyFirebaseInstanceIDService.class));
context.startService(new Intent(context, MyFirebaseMessagingService.class));
}
The two services are nearly the same as on the links I've provided above. And my MainActivity only contains a few Views.
But it doesn't work : as soon as the services are launched, the services are automatically killed and I get a message like this in the logcat :
I/ActivityManager﹕ Killing 3100:com.company.E/u0a85 (adj 15): empty #17
I've searched for solutions about this "killing problem", and I think I've found something interesting here (about WakefulBroadcastReceiver).
If this part of the solution, I met another problem with this answer...
The onHandleIntent() override method he talks about is part of IntentService where my two services are Service.
If this is not part of the solution, I don't know how to prevent my app to be killed...
I've looked at 15 different threads relating to the issue I have and so far none of the solutions have worked for me. While I'm leaning towards it being an Android Manifest Configuration problem I can't seem to see or figure out what exactly I'm doing wrong there. So hoping an extra set of eyes and minds will help me out.
05-29 11:43:46.679 5265-5300/com.example.android.slidingtabsbasic E/AndroidRuntime﹕ FATAL EXCEPTION: AsyncTask #4
java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.containsKey(ConcurrentHashMap.java:781)
at com.facebook.internal.Utility.queryAppSettings(Utility.java:802)
at com.facebook.login.widget.LoginButton$1.run(LoginButton.java:509)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
It seems as though my app_id is returning null? Or something about a hash? I did the facebook Android Quick start and it mentioned hash stuff but I thought it was optional?
Here is my manifest.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.slidingtabsbasic"
android:versionCode="1"
android:versionName="1.0">
<!-- Min/target SDK versions (<uses-sdk>) managed by build.gradle -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<application android:allowBackup="true"
android:label="#string/app_name"
android:icon="#drawable/ic_launcher"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:parentActivityName=".MainActivity"
android:label="#string/app_name">
<activity
android:name="com.facebook.LoginActivity"
android:theme="#android:style/Theme.Translucent.NoTitleBar"
android:label="#string/title_facebook_login"
/>
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/app_id"/>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
The error changes up when I try on API 16 versus a more modern API, giving me AsyncTask #4 (for 16) and AsynTask #2 for (modern API).
Solved it by moving
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/facebook_app_id"/>
outs side of Activity and still inside Application.
My application Name is big and app name truncated on Home Screen.
Is there any way to refer the Full name of application ?
Currently the Application name refers from android:label="#string/app_name"
Eg. An application with the title "abcdefghijklmnopqrstuvwxyz" will be titled "abcdefghi.." on Home Screen.
so Keeping the app shortcut on the home screen with Full name.
Just an FYI, you can optionally do it from the XML.
In the AndroidManifest.xml, you can set it with
android:label="My Activity Title"
Or
android:label="#strings/my_activity_label"
Example:
<activity
android:name=".Splash"
android:label="#string/splash_activity_title" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Go to your Android manifest.xml , where you had declare your activity
there you can change the app_name..
mention in this manner:-
<activity
android:name=".HomeScreenActivity"
android:label="HomeScreen"
android:screenOrientation="portrait" />
I'm getting strange behavior of working NServiceBus sagas deployed on azure cloud service. They never get replied message, never wake up... although if it's deployed locally everything works fine, also sagas works correctly when it's on WebApi cloud service role...
public class EndpointConfiguration : IConfigureThisEndpoint, IWantCustomInitialization,
AsA_Worker, UsingTransport<AzureStorageQueue>
{
public void Init()
{
Feature.Disable<Gateway>();
Feature.Disable<SecondLevelRetries>();
Feature.Enable<TimeoutManager>();
Feature.Enable<Sagas>();
Configure.With()
.UsingContainer<AutofacContainerBuilder>()
.AzureConfigurationSource()
.AzureMessageQueue()
.QueuePerInstance()
.UseNHibernateSagaPersister()
.UseNHibernateSubscriptionPersister()
.UseNHibernateTimeoutPersister()
.UnicastBus();
}
}
that's my config for nsb
<configSections>
<section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core" />
<section name="DBSubscriptionStorageConfig" type="NServiceBus.Config.DBSubscriptionStorageConfig, NServiceBus.NHibernate" />
<section name="NHibernateSagaPersisterConfig" type="NServiceBus.Config.NHibernateSagaPersisterConfig, NServiceBus.NHibernate" />
<section name="TimeoutPersisterConfig" type="NServiceBus.Config.TimeoutPersisterConfig, NServiceBus.NHibernate" />
</configSections>
<UnicastBusConfig>
<MessageEndpointMappings>
<add Messages="Service.InternalMessages" Endpoint="service" />
<add Messages="Messages" Endpoint="service" />
</MessageEndpointMappings>
</UnicastBusConfig>
<DBSubscriptionStorageConfig>
<NHibernateProperties>
<add Key="connection.provider" Value="NHibernate.Connection.DriverConnectionProvider" />
<add Key="connection.driver_class" Value="NHibernate.Driver.SqlClientDriver" />
<add Key="connection.connection_string" Value="Data_Source;Connection Timeout=30;" />
<add Key="dialect" Value="NHibernate.Dialect.MsSql2008Dialect" />
<add Key="hbm2ddl.auto" Value="update" />
</NHibernateProperties>
</DBSubscriptionStorageConfig>
<NHibernateSagaPersisterConfig>
<NHibernateProperties>
<add Key="connection.provider" Value="NHibernate.Connection.DriverConnectionProvider" />
<add Key="connection.driver_class" Value="NHibernate.Driver.SqlClientDriver" />
<add Key="connection.connection_string" Value="Data_Source;Connection Timeout=30;" />
<add Key="dialect" Value="NHibernate.Dialect.MsSql2008Dialect" />
<add Key="hbm2ddl.auto" Value="update" />
</NHibernateProperties>
</NHibernateSagaPersisterConfig>
<TimeoutPersisterConfig>
<NHibernateProperties>
<add Key="connection.provider" Value="NHibernate.Connection.DriverConnectionProvider" />
<add Key="connection.driver_class" Value="NHibernate.Driver.SqlClientDriver" />
<add Key="connection.connection_string" Value="Data_Source;Connection Timeout=30;" />
<add Key="dialect" Value="NHibernate.Dialect.MsSql2008Dialect" />
<add Key="hbm2ddl.auto" Value="update" />
</NHibernateProperties>
</TimeoutPersisterConfig>
that's the configs that I'm using for persisters
NServiceBus.Hosting.Azure, NServiceBus.NHibernate, NServiceBus.Core, NServiceBus.Azure, NServiceBus all of v4.0.30319
I'm using AzureStorageQueue and also I'm sure that I have overridden ConfigureHowToFindSaga with proper ConfigureMapping and I'm replying message with all filed specified correctly...
I would be really appreciate for any ideas, thanks.
This will be an interesting one to figure out. I don't see anything obviously wrong.
So the symptoms are, it works locally (with the exact same config?) and it works when deployed in a webrole (are these the same saga's or different ones?).
Some background info on the latter: a webrole only differs from a worker role in that IIS is properly configured, that's it. This also means that in a webrole, your code is running in 2 places, in an IIS process and in the roleentrypoint process. So you may want to validate that you're actually hosting in a roleentrypoint (namespace NServiceBus.Azure.Hosting and not the default azure sdk one.)
If you're sure the initialisation is done in the right place, you may want to check if you get any errors in the azure logs?
If that doesn't give more detail, you can also enable intellitrace in your solution and download the traces to see what is going on in more detail.
And as a last option, you can also use windbg on the azure instance (RDP'd in) to debug in real time.
Hope any of the above helps!