Great news!
I have tested the latest version and verified that it is working as it should. Thanks!
-Claes
Great news!
I have tested the latest version and verified that it is working as it should. Thanks!
-Claes
I’ve successfully implemented these steps http://coronalabs.com/blog/2013/02/05/ios-tutorial-using-email-attachments/ for iOS to pass the directory path of a saved attachment back into my app. And now I’d LOVE to be able to do the same on the Android side. Any resources available for such a thing?
I’ve successfully implemented these steps http://coronalabs.com/blog/2013/02/05/ios-tutorial-using-email-attachments/ for iOS to pass the directory path of a saved attachment back into my app. And now I’d LOVE to be able to do the same on the Android side. Any resources available for such a thing?
interesting tutorial!
I’ve got my app to launch via a custom url scheme eg myapp://, but could not get it to launch using an intent anchor, eg:
intent://view#Intent;package=com.mypackageid;scheme=myapp;end;
from the launching app I get this generic error:
I/Corona (29076): Warning: system.openURL() failed to open URL: intent://view#Intent;package=com.mypackageid;scheme=myapp;end;
Is there something wrong with the intent anchor syntax, or do I require something additional in build.settings? Or does corona just not support intent anchors?
relevant section from build.settings:
[lua]
intentFilters =
{
{
label = “launch from URL”,
actions = { “android.intent.action.VIEW” },
categories =
{
“android.intent.category.DEFAULT”,
“android.intent.category.BROWSABLE”,
},
data = { scheme = “myapp” },
},
}
[/lua]
Corona will just pass your URL to the appropriate Android OS as-is. So, perhaps the Android OS doesn’t know what to do with it?
I’ve never tried an Android intent URL with an anchor tag before. I don’t think that’s commonly used by Android developers. I typically see URL arguments passed in Android intents instead. For example:
myapp://mypage?x=1&y=2
I know URL arguments are supported by Android intents. Corona internally uses them to launch a Corona app when its local/push notification has been tapped on the top status bar. This is how we identify which notification got tapped on.
I can use the myapp:// method, but given i’m going to implement this across 30+ android apps, it would be easier to document and manage if the scheme was identical and I could just say “insert package name here”
I have read some articles that suggest that while intent:// is not commonplace, it should work:
https://developer.chrome.com/multidevice/android/intents
http://stackoverflow.com/questions/23231589/intent-anchor-syntax-description
Examining the source of the toURI() method in the Intent class, my URI looks ok. I just can’t get it to work.
In any case this is by no means a showstopper, just a nice to have and I also hate to leave a problem unsolved!
thanks
I’m not set up to test Android apps at the moment. So, would you mind doing the following quick test?
Try changing the following intent-filter part in your app from this…
data = { scheme = “myapp” },
…to this…
data = { scheme = “myapp” android:host=“com.mypackageid” android:path="/view/"},
The above should theoretically make the following URI work according to Google’s example…
intent://view/#Intent;scheme=myapp;package=com.mypackageid;end
this gave me a build error: Syntax error: ‘}’ expected near ‘android’
[lua]
data = { scheme = “myapp” android:host=“com.mypackageid” android:path="/view/" }
[/lua]
adding commas gave me a different build error: Syntax error: function arguments expected near ‘=’
[lua]
data = { scheme = “myapp” , android:host=“com.mypackageid” , android:path="/view/" }
[/lua]
They both ran OK in the simulator but a modal dialog appeared during the build:
There is an error in your build.settings.
Please correct the error and try building again. (Check the console for more information.)
this built ok, but i still could not launch the app with the intent anchor
[lua]
data = { scheme = “myapp” , host=“com.mypackageid” , path="/view/" }
[/lua]
Sorry. I copied and pasted that from XML and forgot to convert it to the appropriate Lua syntax. What you scripted at the bottom of your post is what was needed.
If what I suggested doesn’t work, then I don’t know what else to recommend. From what I gathered from Google’s write-up that you linked to, this anchor intent syntax is an undocumented feature that is only supported by Google’s Chrome browser app. Meaning that it most likely won’t work in an embedded native WebView or via native Android APIs used to launch Android intents (like the ones Corona uses to launch an app via system.openURL() function). In which case, implementing your own URL scheme or, even better, using an http:// scheme where you set up an intent-filter to launch your app via the host/domain name would be better from a cross-platform and cross-browser standpoint.
interesting tutorial!
I’ve got my app to launch via a custom url scheme eg myapp://, but could not get it to launch using an intent anchor, eg:
intent://view#Intent;package=com.mypackageid;scheme=myapp;end;
from the launching app I get this generic error:
I/Corona (29076): Warning: system.openURL() failed to open URL: intent://view#Intent;package=com.mypackageid;scheme=myapp;end;
Is there something wrong with the intent anchor syntax, or do I require something additional in build.settings? Or does corona just not support intent anchors?
relevant section from build.settings:
[lua]
intentFilters =
{
{
label = “launch from URL”,
actions = { “android.intent.action.VIEW” },
categories =
{
“android.intent.category.DEFAULT”,
“android.intent.category.BROWSABLE”,
},
data = { scheme = “myapp” },
},
}
[/lua]
Corona will just pass your URL to the appropriate Android OS as-is. So, perhaps the Android OS doesn’t know what to do with it?
I’ve never tried an Android intent URL with an anchor tag before. I don’t think that’s commonly used by Android developers. I typically see URL arguments passed in Android intents instead. For example:
myapp://mypage?x=1&y=2
I know URL arguments are supported by Android intents. Corona internally uses them to launch a Corona app when its local/push notification has been tapped on the top status bar. This is how we identify which notification got tapped on.
I can use the myapp:// method, but given i’m going to implement this across 30+ android apps, it would be easier to document and manage if the scheme was identical and I could just say “insert package name here”
I have read some articles that suggest that while intent:// is not commonplace, it should work:
https://developer.chrome.com/multidevice/android/intents
http://stackoverflow.com/questions/23231589/intent-anchor-syntax-description
Examining the source of the toURI() method in the Intent class, my URI looks ok. I just can’t get it to work.
In any case this is by no means a showstopper, just a nice to have and I also hate to leave a problem unsolved!
thanks
I’m not set up to test Android apps at the moment. So, would you mind doing the following quick test?
Try changing the following intent-filter part in your app from this…
data = { scheme = “myapp” },
…to this…
data = { scheme = “myapp” android:host=“com.mypackageid” android:path="/view/"},
The above should theoretically make the following URI work according to Google’s example…
intent://view/#Intent;scheme=myapp;package=com.mypackageid;end
this gave me a build error: Syntax error: ‘}’ expected near ‘android’
[lua]
data = { scheme = “myapp” android:host=“com.mypackageid” android:path="/view/" }
[/lua]
adding commas gave me a different build error: Syntax error: function arguments expected near ‘=’
[lua]
data = { scheme = “myapp” , android:host=“com.mypackageid” , android:path="/view/" }
[/lua]
They both ran OK in the simulator but a modal dialog appeared during the build:
There is an error in your build.settings.
Please correct the error and try building again. (Check the console for more information.)
this built ok, but i still could not launch the app with the intent anchor
[lua]
data = { scheme = “myapp” , host=“com.mypackageid” , path="/view/" }
[/lua]
Sorry. I copied and pasted that from XML and forgot to convert it to the appropriate Lua syntax. What you scripted at the bottom of your post is what was needed.
If what I suggested doesn’t work, then I don’t know what else to recommend. From what I gathered from Google’s write-up that you linked to, this anchor intent syntax is an undocumented feature that is only supported by Google’s Chrome browser app. Meaning that it most likely won’t work in an embedded native WebView or via native Android APIs used to launch Android intents (like the ones Corona uses to launch an app via system.openURL() function). In which case, implementing your own URL scheme or, even better, using an http:// scheme where you set up an intent-filter to launch your app via the host/domain name would be better from a cross-platform and cross-browser standpoint.