background
am trying to launch waze with following intent from an asynctask onPostExecute after the task geocodes an address, but it is not working. the link works fine, it as ill explain, it has something todo with launching an intent from the onPostExecute says cannot resolve intent in logcat.
class declaration:
public static class WazeAsyncLaunch extends AsyncTask<String, Void, Intent> {
Context mContext = null;
public WazeAsyncLaunch(Context context){
mContext = context;
}
this is the doInBackground
protected Intent doInBackground(String... addresses) {
//does geocoding here, i give short version
Uri intentURI = Uri.parse("https://waze.com/ul?ll=48.8566969,2.3514616&navigate=yes");
Intent mapIntent = new Intent(Intent.ACTION_VIEW);
mapIntent.setData(intentURI);
mapIntent.addCategory(Intent.CATEGORY_DEFAULT);
mapIntent.addCategory(Intent.CATEGORY_BROWSABLE);
return mapIntent;
}
and here is onPostExecute, where the error is happening
protected void onPostExecute(Intent result) {
mContext.startActivity(result);
}
i call it from a button onclick event handler in mainactivity like this
new WazeAsyncLaunch(MainActivity.this).execute(address);
based on community pointer i also tried this in my onPostExecute, to no avail
String url = "https://www.waze.com/ul?ll=40.75889500%2C-73.98513100&navigate=yes&zoom=17";
Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( url ) );
startActivity( intent );
interestingly, also doesnt work when i do:
adb shell am start -a android.intent.action.VIEW -c android.intent.category.DEFAULT -c android.intent.category.BROWSABLE -d https://waze.com/ul?ll=48.8566969,2.3514616&navigate=yes
but it does work when i do:
adb shell am start -d https://waze.com/ul?ll=48.8566969,2.3514616&navigate=yes
it also works when i click this link on my phone https://waze.com/ul?ll=48.8566969,2.3514616&navigate=yes
pointers:
there is no browser installed on the device. (only waze).
--in the manifest of waze is following 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="http"/>
<data android:scheme="https"/>
<data android:host="www.waze.com"/>
<data android:host="waze.com"/>
<data android:pathPattern="/ul.*"/>
</intent-filter>
so dont know why my code is not working, however given the fact of adb and link click, i see the intent works when only the data is passed without category and action. but i do not know how to launch an intent in java with only data and no other properties.
question
how can i launch an intent from java with only a data string? or if theres another solution?