我有搜索并找到解决方案,但该解决方案未显示多行推送通知。 我的代码如下,
@href = @OrderDet['_links']['https://api.slimpay.net/alps#get-mandate']['href'].to_s
@manHref = @href.split('/')
@customID = @manHref[4]
appOpt = {
'Accept' => "application/hal+json; profile='https://api.slimpay.net/alps/v1'",
'Content-type' => 'application/hal+json',
'grant_type' => 'client_credentials',
'scope' => 'api'
}
@basic_auth = { username: "#{Slimpay.configuration.client_id}", password: Slimpay.configuration.client_secret }
getTok = HTTParty.post('https://api.slimpay.net/oauth/token', basic_auth: @basic_auth, body: appOpt)
@token = getTok['access_token']
myArray = @manHref
myArray.pop
@urlTest = myArray.join("/")
appOpt1 = {
'Accept' => "application/hal+json",
'Authorization' => "Bearer #{@token}"
}
@reqUR = "#{@urlTest}?id=#{@customID}"
getMen = HTTParty.get(@reqUR, headers: appOpt1)
@mendatedetails = JSON.parse(getMen)
@logData.mandateres = getMen
如何在推送通知中显示多行文字?
答案 0 :(得分:0)
Intent intent = new Intent(this, target.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
PendingIntent.FLAG_ONE_SHOT);
Bitmap image= BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher);
Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.youricon)
.setContentTitle("Title")
.setLargeIcon(image)
.setContentText("Message")
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent)
.setStyle(new NotificationCompat.BigPictureStyle().bigPicture(bitmap).setSummaryText("multiline text"));
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(m/* ID of notification */, notificationBuilder.build());