android - intent-filter for a service : using a custom mime type -
i want add custom mime android service or broadcastreceiver detect custom files. have seen answers questions how add custom mime type? , how add custom mime type?
the answers here shown activity. modifications required service or broadcastreceiver? tried same code them, did not work. new android development. nice , detailed explanation welcome. possible? going wrong.
the code used :
<service android:name="xcardreceivedservice" android:exported="true" android:enabled="true"> <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="file" /> <data android:mimetype="*/*" /> <data android:pathpattern=".*\\.xcard" /> <data android:host="*" /> </intent-filter> </service>
but before activity started want add data file database
you have in activity.
or purpose wanted write service or broadcast receiver.
files not open in service or broadcast receiver.
is there other possible way?
put code activity.
how should differentiate between "how activity started" whether other activity or when user clicked on file.
examine intent
used start activity. intent
via getintent()
. can call getdata()
on intent
uri
associated it. if not null
, should path file.
Comments
Post a Comment