Solution 1 :
There are so many questions being asked here, not a single one
How can I attach the data to the image so that when it is clicked on by the user it opens the app, saves the data and then shows the new CardView
The answer is you can’t do anything like that automatically. You need to manually implement some code for receiving that push and then create the card instance in your recycler yourself.
My suggestion based on your database comments, is to have your recyclerview monitor your db with live data to create those card instances. You just store each card you receive.
Would an SVG image file work in this case because links can be embedded within the SVG?
That kind of security and privacy violation would probably (deservedly) get an app banned, so don’t do that
Would an AppWidgetProvider and RemoteViews work here?
That’s completely unrelated to anything here, that’s for adding dynamic content to the home screen
when the receiving user clicks on the image in the SMS text, the app would be opened
Monitoring users sms is a touchy subject now, for both users and for Google. Ensuring that your app handles a link clicked in an sms (even a dynamic link) is error prone and difficult now. A much better idea than sending sms (which also costs the user money) is to use any kind of pub-sub model. Lots of libraries and services offer this. Firebase can be used this way too.
Solution 2 :
I’m not sure if its possible what you are looking for, but I think your best approach would be to use firebase dynamic links.
Problem :
I have a RecyclerView list of CardViews that hold a small amount of user data. The data is saved to the app’s SQLite database. I would like to send a CardView’s data from one app user to another via SMS/MMS. The SMS is sent when the user clicks the share icon on the CardView. Then when the receiving user clicks on the image in the SMS text, the app would be opened/brought to the forefront, the data would be saved in the recipient’s SQLite database and then the RecyclerView list would be shown with a new CardView from the data that was passed via SMS.
I am able to attach the image to the SMS text message and am able to send and receive the image and the message:
How can I attach the data to the image so that when it is clicked on by the user it opens the app, saves the data and then shows the new CardView in the RecyclerView list? Would an SVG image file work in this case because links can be embedded within the SVG? Can I save the data in a JSONObject and attach it to the SVG and then when the user clicks on the image the JSON can be parsed in the app, saved to the database and then the updated UI for the RecyclerView list of CardViews can be shown? Would an AppWidgetProvider and RemoteViews work here? Or is there another way to attach data to the image that can be passed to the receiving app once the user confirms their acceptance by clicking on the image?
MainActivity
...
public void onShareIconClick(View view, Card cardFromShareIcon, int clickPos) {
final Intent smsIntent = new Intent(Intent.ACTION_SEND);
String phoneMsg = "here's a card for you:";
smsIntent.putExtra(Intent.EXTRA_TEXT, phoneMsg);
smsIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
smsIntent.setDataAndType(shareUri,getContentResolver().getType(shareUri));
smsIntent.putExtra(Intent.EXTRA_STREAM,shareUri);
try {
if (smsIntent.resolveActivity(getPackageManager()) != null) {
startActivity(smsIntent);
}
} catch (Exception e) {
Log.w(TAG2, "Could not open Text Messenger app", e);
// Inform user
Toast.makeText(this,
"Could not open your Text Messaging app.",
Toast.LENGTH_LONG).show();
}
}
Comments
Comment posted by AJW
Much thanks for the idea. I will check out the links to see if that approach can work.